package com.demo.testui;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

/*
本页是最初的样子
现在想要通过一个值控制view的显示大小及点击范围，比如，尺寸缩小为原来的70%，点击范围也跟着变为原来的70%。
*/
public class ActivityOriginal extends Activity {
    String TAG = Tags.original;
    View mView;
    MyView mMyView;
    MyViewGroup mMyViewGroup;
    float percent = Constant.PERCENT_SHOW;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test_view_size);

        //重置自定义的View
        MyView.percent = Constant.PERCENT_DEFAULT;
        MyViewGroup.percent = Constant.PERCENT_DEFAULT;

        init();
    }

    private void init() {
        mView = findViewById(R.id.click_area_view);
        mMyView = findViewById(R.id.click_area_myview);
        mMyViewGroup = findViewById(R.id.click_area_myviewgroup);
        mView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(),"View",Toast.LENGTH_SHORT).show();
            }
        });
        mMyView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(),"MyView",Toast.LENGTH_SHORT).show();
            }
        });
        mMyViewGroup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(v.getContext(),"MyViewGroup",Toast.LENGTH_SHORT).show();
            }
        });
    }

}
